import React from 'react'
import ReactDOM from 'react-dom/client'
import { RouterProvider, createRouter } from '@tanstack/react-router'
// 导入用户上下文提供者
import { UserProvider } from './contexts/UserContext'

// 导入路由树
import { routeTree } from './routeTree.gen'

// 创建路由器实例
const router = createRouter({ routeTree })

// 渲染应用
const rootElement = document.getElementById('root')
if (rootElement) {
  const root = ReactDOM.createRoot(rootElement)
  root.render(
    <React.StrictMode>
      <UserProvider>
        <RouterProvider router={router} />
      </UserProvider>
    </React.StrictMode>
  )
}